package com.bdqn.t313.jdkdynamicproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * jdk实现动态代理
 */
public class EnglishTeacherDao implements InvocationHandler {

    //被代理对象，使用接口
    Object target;

    public EnglishTeacherDao(Object iTeacherDao){

        this.target = iTeacherDao;
    }


    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        //
        System.out.println("代课老师课前抽查作业....");
        Object feedback = method.invoke(target, args);
        System.out.println("代课老师课后布置作业....");
        return feedback;
    }
}
